import { MockMethod } from 'vite-plugin-mock';
import { resultError, resultSuccess, getRequestToken, requestParams, baseUrl } from '../_util';

const requireFile = (fileUrl) => {
    return require( "../json/" + fileUrl)
}

export default [
    {
        url: `${baseUrl}/sys/login`,
        method: 'post',
        response: ({ body }) => {
            console.log("sys/login--body", body)
            return requireFile('login.json')
        }
    },
    {
        url: `${baseUrl}/sys/user/getUserInfo`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('getUserInfo.json')
        }
    },
    {
        url: `${baseUrl}/sys/permission/getPermCode`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('getPermCode.json')
        }
    },
    {
        url: `${baseUrl}/sys/permission/getUserPermissionByToken`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('getUserPermissionByToken.json')
        }
    },
    {
        url: `${baseUrl}/sys/user/set/querySysUserSetByUserId`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('querySysUserSetByUserId.json')
        }
    },
    {
        url: `${baseUrl}/sys/project/queryById`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('projectQueryById.json')
        }
    },
    {
        url: `${baseUrl}/sys/annountCement/listByUser`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('listByUser.json')
        }
    },
    {
        url: `${baseUrl}/sys/user/list`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('userList.json')
        }
    },
    {
        url: `${baseUrl}/sys/project/select/list`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('projectSelectList.json')
        }
    },
    {
        url: `${baseUrl}/uav/task/qureyTaskListByDay`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('qureyTaskListByDay.json')
        }
    },
    {
        url: `${baseUrl}/uav/device/query`,
        method: 'get',
        response: ({ query }) => {
            const { deviceType} = query;
            if(deviceType === '3') return requireFile('deviceQuery.json')
            if(deviceType === '2') return requireFile('deviceQuery-2.json')
        }
    },
    {
        url: `${baseUrl}/uav/device/track/query`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('deviceTrackQuery.json')
        }
    },
    {
        url: `${baseUrl}/uav/device/track/get`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('deviceTrackGet.json')
        }
    },
    {
        url: `${baseUrl}/uav/device/track/trackFileContent`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('trackFileContent.json')
        }
    },
    {
        url: `${baseUrl}/online/cgform/head/list`,
        method: 'get',
        response: ({ query }) => {
            const { pageNo} = query;
            if(pageNo === '1') return requireFile('cgformHeadList.json')
            if(pageNo === '2') return requireFile('cgformHeadList-2.json')
            if(pageNo === '3') return requireFile('cgformHeadList-3.json')
            if(pageNo === '4') return requireFile('cgformHeadList-4.json')
        }
    },
    {
        url: `${baseUrl}/online/cgform/field/listByHeadId`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('listByHeadId.json')
        }
    },
    {
        url: `${baseUrl}/sys/duplicate/check`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('duplicateCheck.json')
        }
    },
    {
        url: `${baseUrl}/online/cgform/index/listByHeadId`,
        method: 'get',
        response: ({ query }) => {
            return requireFile('indexListByHeadId.json')
        }
    },
] as MockMethod[];